<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link th:replace="template/sys_header :: header"/>
    <script type="text/javascript" th:replace="template/sys_header :: footer"></script>
</head>
<body class="login-bg">

<div class="login">
    <div class="message">ZyAdmin 1.0-管理登录</div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form">
        <input name="username" placeholder="用户名" type="text" lay-verify="required" class="layui-input">
        <hr class="hr15">
        <input name="password" placeholder="密码" type="password" lay-verify="required" class="layui-input">
        <hr class="hr15">
        <input class="loginin" value="登录" lay-submit="" lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20">
        <div>
            前端静态展示，请随意输入，即可登录。
        </div>
    </form>
</div>
<script type="text/javascript" th:src="@{/js/sys/login.js}"></script>
<script type="text/javascript">
    layui.use(['form'], function(){
        var form = layui.form;
        //监听提交
        form.on('submit(login)', function(data){
            //console.log(data);
            var username = data.field.username;
            var password = data.field.password;
            //loading层
            var index = layer.load(2);
            //发起请求
            ZyAjax("sys/login", " POST" , {userAccount : username , userPwd : password} , function (result) {
                console.log(result);
                layer.close(index);
                layer.alert("登录成功，正在跳转...");
                //layer.msg("登录成功，正在跳转...",function(){
                   //location.href='./index.html'
                //});
            },function (error) {
                layer.close(index);
            });
            return false;
        });
    });
</script>
<!-- 底部结束 -->

</body>
</html>